// 格式化图片大小文案
export const formatImageSizeText = (size) => {
  if (size < 1024) {
    return `${size}B`;
  }
  const units = ["B", "KB", "MB", "GB", "TB"];
  let unitIndex = 0;

  while (size >= 1024 && unitIndex < units.length - 1) {
    size /= 1024;
    unitIndex++;
  }

  return `${size.toFixed(2)}${units[unitIndex]}`;
};
